package com.jerkin.service.decorator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;



/**
 * @version V1.0
 * @ClassName: DecotatorFactory
 * @Description:
 * @author: huhongzhi
 * @date: 2019/12/30 23:30
 */
@Component
public class DecotatorFactory extends AbsOrderPrice{

    @Autowired
    private OriginalOrderPrice originalOrderPrice;

    @Autowired
    private DiscountCouponService discountCouponService;

    @Override
    public BigDecimal calculate() {
        return create().calculate();
    }

    private AbsOrderPrice create(){
        discountCouponService.setAbsOrderPrice(originalOrderPrice);
        return discountCouponService;
    }
}
